<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ page import="de.openlaboratory.xmleditor.servlet.view.menu.MenuConfigurator" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/xml" prefix="x" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

<script type="text/javascript" src="script/js/jquery-1.9.1.js"></script>
<script type="text/javascript" src="script/js/jquery-migrate-1.2.1.js"></script>
<script type="text/javascript" src="script/js/jquery.tablesorter.js"></script>
<script type="text/javascript" src="script/js/jquery.tablesorter.pager.js"></script>

<link rel="stylesheet" type="text/css" href="script/css/style.css">

<script type="text/javascript">
	$(document).ready(function() 
	    { 
			$("table") 
		    .tablesorter({widgets: ['zebra']}) 
		    .tablesorterPager({container: $("#pager")}); 
			
	        // $("#myTable").tablesorter(); 
	    } 
	); 
</script>

<title>Edit XML File</title>

</head>
<body>

<% String xmlFile = (String) request.getAttribute("xmlFile"); %>
<% MenuConfigurator menuConfig = new MenuConfigurator("action"); %>

<div id="navigation_menu">
	<% out.print(menuConfig.displayMenu()); %>
</div>


<form action="edit" method="post">
	<input name="xml_file" type="hidden" value="<%= xmlFile %>" />
	<input name="xml_action" type="hidden" value="create" />
	
	Name: <input name="sName" type="text" value="" /><br />
	Value: <input name="sValue" type="text" value="" />

	<input name="xml_submit" type="submit" value="add entry" />
</form>

<c:if test="${not empty message}">
    <div id="message">
		<%= request.getAttribute("message") %>
	</div>
</c:if>

<hr />

Cache: <%= request.getAttribute("cachedValoo") %>

<hr />

	<h1>XML File Contents</h1>
    <c:import var="xmlFile" url="../../res/xml/${xmlFile}" charEncoding="UTF-8" />
    
    <x:parse var="myDoc" xml="${xmlFile}" />

    <table  id="myTable" class="tablesorter">
	    <thead>
	      <tr>
	        <th>Name</th>
	        <th>Value</th>
	      </tr>
	    </thead> 
		<tbody>
	      <x:forEach select="$myDoc/DATA/jobs/advertisement" var="cust">
	        <tr>
	          <td><x:out select="$cust/name" /></td>
	          <td><x:out select="$cust/value" /></td>
	        </tr>
	      </x:forEach>
	    </tbody> 
    </table>
    
    <div id="pager" class="pager">
		<form>
			<img src="res/img/first.png" class="first"/>
			<img src="res/img/prev.png" class="prev"/>
			<input type="text" class="pagedisplay"/>
			<img src="res/img/next.png" class="next"/>
			<img src="res/img/last.png" class="last"/>
			<select class="pagesize">
				<option selected="selected"  value="10">10</option>
				<option value="20">20</option>
				<option value="30">30</option>
				<option  value="40">40</option>
			</select>
		</form>
	</div>

</body>
</html>